package com.shujia.scala

object Demo8CaseClass {
  def main(args: Array[String]): Unit = {

    //样例类不需要通过new创建对象
    val student: Student = Student("001", "张三", 23, "男", "一班")

    //修改属性值
    student.name = "李四"

    //获取属性值
    println(student.name)

    //已经重写了toString方法
    println(student)

  }

  /**
   * 样例类: scala中一个特殊的类，scala再编译的过程中会动态给这个类增加方法（get set toString hashcode）
   */

  case class Student(id: String, var name: String, age: Int, gender: String, clazz: String)

}
